#pragma once
#include <vector>
#include <cassert>
#include <memory>

namespace PhysLeo {

/**
 * Node is the basic unit which constructs the whole scene graph.
 */
class Node {
public:
    /**
     * default constructor.
     */
    Node() = default;

    /**
     * delete default copy constructor
     */
    Node(const Node&) = delete;

    /**
     * delete default move constructor
     */
    Node(Node&&) = delete;

    /**
     * delete default copy assignment function
     */
    Node& operator=(const Node&) = delete;

    /**
     * delete default move assignment function
     */
    Node& operator=(Node&&) = delete;

    /**
     * default virtual destructor
     */
    virtual ~Node() = default;

    /**
     * add child node
     * @param[in] child  shared_ptr points to the child node
     */
	void addChild(const std::shared_ptr<Node>& child)
	{
	    childs_.push_back(child);
	}

    /**
     * the size of child nodes
     * @return int
     */
    int size() const
	{
	    return static_cast<int>(childs_.size());
	}

    /**
     * get child node by index
     * @param[in] idx  child index
     * @return shared_ptr points to the specific child node
     */
    std::shared_ptr<Node> getChild(const int idx) const
	{
	    assert(idx < childs_.size()); return childs_[idx];
	}
	
protected:
    /**
     * vector container of child nodes
     */
	std::vector<std::shared_ptr<Node>> childs_;
};


}